package lib

import (
	"gincli/global"
	"github.com/gin-gonic/gin"
)

type RouterGroup struct {
	*gin.RouterGroup
}

func InitRouter() *gin.Engine {
	gin.SetMode(global.Config.System.Env)
	router := gin.Default()
	if global.Config.System.Static == "" {
		global.Config.System.Static = "static"
	}
	router.Static("/static", global.Config.System.Static)
	var template string
	if global.Config.System.Template == "" {
		global.Config.System.Template = "template/**/*"
	}
	template = global.Config.System.Template
	router.LoadHTMLGlob(template)
	return router
}
